﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace ExpertSMS.Models
{
    public class Product
    {
        public int ProductID { get; set; }
        [Display(Name="ชื่อ")]
        public string Name { get; set; }

        public virtual ICollection<Unit> Units { get; set; }
        public virtual ICollection<StoreProductStock> StoreProductStocks { get; set; }
        public virtual Unit MainUnit
        {
            get
            {
                return this.Units.FirstOrDefault(x => !x.ParentUnitID.HasValue);
            }
        }

        public virtual ICollection<MakeFoodProduct> MakeFoodProducts { get; set; }
        public virtual ICollection<FoodProduct> FoodProducts { get; set; }
    }
}